package com.itheima.job;

import java.util.*;

public class Test08 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        char[] chars = s.toCharArray();
        HashMap<String,Integer> hm = new HashMap<>();
        for (char aChar : chars) {

            int i = 0;
            for (int j = 0; j < chars.length; j++) {
                if (chars[j] == aChar){
                    i++;
                }
            }
            hm.put(String.valueOf(aChar),i);
        }

        Set<Map.Entry<String, Integer>> entries = hm.entrySet();
        for (Map.Entry<String, Integer> entry : entries) {
            System.out.print(entry.getKey()+"("+entry.getValue()+")");
        }
    }

}
